<template>
	<view class="Jy_my_info_page">
		<view class="Jy_my_info_content_group">
			<!-- 基础信息模块 -->
			<view class="Jy_my_info_basic_title_box">
				<text>基础信息</text>
			</view>
			<view class="Jy_my_info_basic_ct_group">
				<!-- 头像 -->
				<view class="Jy_my_info_basic_ct_box border_bottom" @click="getHeadImage()">
					<view class="left_name_box">
						<text>头像</text>
					</view>
					<view class="right_info_group">
						<view class="heade_image_box">
							<image :src="user.avatar" mode="aspectFill"></image>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
				<!-- 账号 -->
				<view class="Jy_my_info_basic_ct_box border_bottom">
					<view class="left_name_box">
						<text>账号</text>
					</view>
					<view class="right_info_group">
						<view class="info_text_box">
							<text>abx422j</text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
				<!-- 昵称 -->
				<view class="Jy_my_info_basic_ct_box border_bottom" @click="getUpdateInfo(1, user.nickname)">
					<view class="left_name_box">
						<text>昵称</text>
					</view>
					<view class="right_info_group">
						<view class="info_text_box">
							<text>{{user.nickname}}</text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
				<!-- 个人简介 -->
				<view class="Jy_my_info_basic_ct_box border_bottom" @click="getUpdateInfo(2, user.briefIntroduction)">
					<view class="left_name_box">
						<text>个人简介</text>
					</view>
					<view class="right_info_group">
						<view class="info_text_box">
							<text>{{user.briefIntroduction}}</text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
				<!-- 收货地址 -->
				<view class="Jy_my_info_basic_ct_box" @click="getShippingAddress()">
					<view class="left_name_box">
						<text>收货地址</text>
					</view>
					<view class="right_info_group">
						<view class="info_text_box">
							<text></text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
			</view>
			
			<!-- 账号绑定模块 -->
			<view class="Jy_my_info_account_bing_title_box">
				<text>账号绑定</text>
			</view>
			<view class="Jy_my_info_account_bing_ct_group">
				<!-- 手机号绑定 -->
				<view class="Jy_my_info_basic_ct_box border_bottom" @click="getBindPhone(user.phone)">
					<view class="left_name_box">
						<view class="phone_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/account_banding/phone.png" mode="aspectFill"></image>
						</view>
						<view class="phone_text_box">
							<text>手机</text>
						</view>
					</view>
					<view class="right_info_group">
						<view class="info_text_box" v-if="user.phone">
							<text>{{user.phone}}</text>
						</view>
						<view class="info_text_box" v-else>
							<text>未绑定</text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
				<!-- 微信绑定 -->
				<view class="Jy_my_info_basic_ct_box">
					<view class="left_name_box">
						<view class="phone_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/account_banding/wechat.png" mode="aspectFill"></image>
						</view>
						<view class="phone_text_box">
							<text>微信</text>
						</view>
					</view>
					<view class="right_info_group">
						<view class="info_text_box">
							<text>已绑定</text>
						</view>
						<view class="right_icon_box">
							<image src="http://120.78.177.187:8083/crmebimage/public/mpImage/main_menu/right.png" mode="aspectFit"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		
		<u-popup :show="headShow" @close="headClose" :round="10" @open="headOpen" mode="bottom">
		      <view class="head_image_group">
		            <view class="head_image_box">
					<view class="gh_user_head_image_box">
						<text>更换头像</text>
					</view>
		            	<view class="image_group">
						<view class="image_list" v-for="(item, index) in headImageList" :key="index">
							<view class="image_container">
								<image :src="item.imgUrl" mode="aspectFill"></image>
							</view>
						</view>
		            	</view>
					<view class="careme_box">
						<text>手机相册上传</text>
					</view>
					<view class="ceche_box" @click="headClose">
						<text>取消</text>
					</view>
		            </view>
		      </view>
		</u-popup>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 用户信息
				user: {},
				headShow: false,
				headImageList: [
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/1.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/2.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/3.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/4.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/5.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/6.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/7.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/8.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/9.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/10.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/11.png'
					},
					{
						imgUrl: 'http://120.78.177.187:8083/crmebimage/public/index/12.png'
					}
				] 
			};
		},
		onLoad(option) {
			this.getUserInfo(JSON.parse(option.userIfo))
		},
		methods: {
			// 跳转到收货地址
			getShippingAddress() {
				uni.navigateTo({
					url: '/pagesA/main/customerMyCenter/shippingAddress/shippingAddress'
				})
			},
			// 更改个人信息
			getUpdateInfo(key, data) {
				uni.navigateTo({
					url: '/pagesA/main/customerMyCenter/updateInfo/updateInfo?key=' + key + '&data=' + data
				})
			},
			// 跳转到绑定手机号
			getBindPhone(phone) {
				uni.navigateTo({
					url: '/pagesA/main/customerMyCenter/bindPhone/bindPhone?phone=' + phone
				})
			},
			headClose() {
				this.headShow = false
			},
			headOpen() {
				
			},
			getHeadImage() {
				this.headShow = true; 
			},
			getUserInfo(userInfo) {
				if (userInfo) { 
					this.user = userInfo;
					console.log("用户信息:" + userInfo)
				} else {
					uni.showToast({
						icon: 'error',
						title: '未获取到用户信息'
					})
					uni.reLaunch({
						url: '/pages/main/customerHome/customerHome'
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
@import 'myInfo.scss';
</style>
